import observe from './observe';
import Watcher from './Watcher';

let obj = {
    name: '张三',
    age: 14,
    likes: ['西瓜', '葡萄', '哈密瓜'],
    text: ''
};

// let arr = [1,2,3];
// observe(arr);
observe(obj);
console.log(obj);
// console.log(arr);
window.onload = (() => {
    new Watcher(obj, 'age', (newValue, oldValue) => {
        console.log(newValue, oldValue);
    });
    // console.log(document.querySelector('#btn'));
    const btn = document.querySelector('#btn');
    // const word = document.querySelector('#word');
    const hText = document.querySelector('#age');
    const input = document.querySelector('input');

    input.oninput = function (e) {
    	// myVue.data.name = e.target.value
        // console.log(e);
        obj.text = e.target.value;
        console.log(obj);
    }

    btn.onclick = () => {
        obj.age++;
    };
});
